<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
  	<meta charset="UTF-8">
  	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  	<title>订单找回页面frm</title>
  	<link rel="stylesheet" type="text/css" href="../../../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../../../css/aui.css" />
	  <link rel="stylesheet" type="text/css" href="../../../css/iconfont.css" />
  	<link rel="stylesheet" type="text/css" href="../../../css/common.css" />
    <style>
        .container{padding:0.266rem 0.506rem;}
        .platformBox{height:0.8rem;display: flex;flex-wrap: nowrap;align-items: center;justify-content: space-between;border-radius: 0.2rem;overflow: hidden;}
        .platformBox div{color: #333;width: 32%;height:0.8rem;display: flex;align-items: center;justify-content:center;font-size: 0.4rem;background: #f4f4f4;}
        .sgactive{background: #ff4c41 !important;color: #fff !important}
        .orderNumBox{padding: 1rem 0 0.58rem;}
        .orderNumBox1{padding:0 1.25rem;}
        .orderNumBox1 input{font-size:0.4rem;color: #999;text-align: center;color: #333;border-bottom: 1px solid #ededed;height: 1.4rem;}
        .orderNumBox1 div{width: 100%;background: #ff4c41;height: 1.14rem;color: #fff;border-radius: 0.57rem;margin:1rem 0;font-size: 0.48rem;
          display: flex;align-items: center;justify-content: center;}
        .container2{margin-top: 0.26rem;padding:0.61rem 0.4rem 3rem;font-size: 0.373rem;color: #666;}
        .container2 p{font-size: 0.373rem;color: #666;}
    </style>
</head>
<body id="wrap">
    <div class="container sg-color-bg1">
        <div class="platformBox sg-color-bg1">
            <div class="sgactive" tapmode onclick="platformChange(0)">淘宝</div>
            <div class="" tapmode onclick="platformChange(1)">拼多多</div>
            <div class="" tapmode onclick="platformChange(2)">京东</div>
        </div>
        <div class="orderNumBox">
            <div class="orderNumBox1">
                <input type="text" class="orderNumInput" placeholder="请输入或粘贴订单号" name="" value="">
                <div tapmode onclick="orderNumFun()">提交订单号</div>
            </div>
            <p class="sg-text-size24 sg-color-font5"><span class="platformMsg1">淘宝</span>订单跟踪可能有延迟,通常在下单5分钟内跟踪到，建议在下单10分钟
              后再查。本功能只适用找回1小时内付款的订单。如未能找回订
              单，请点击加入<span class="sg-color-font3" tapmode onclick="openExclusiveFun()">省果APP用户反馈群</span>反馈问题
            </p>
        </div>
    </div>
    <div class="container2 sg-color-bg1">
        <p class="sg-text-size34 sg-color-font2">如何获取订单号</p>
        <p style="padding-top:0.46rem">第一步：</p>
        <p style="padding-top:0.46rem">打开<span class="platformMsg1">淘宝</span>，在相应的订单详情页，滑动至订单编号，点击复制，如下示例</p>
        <img class="orderCourseImg" style="padding-top:0.54rem;width:100%;height:auto;" src="../../../image/me/orderNum1.png" alt="">
        <p style="padding-top:0.46rem">第二步：</p>
        <p style="padding-top:0.46rem">打开省果，在“我的”页面，点击“全部订单”，然后打开点击“立即补单”，在订单找回页面中粘贴订单号，选中商城类型，点击“提交订单号即可”</p>
    </div>
</body>
<script type="text/javascript" src="../../../script/api.js"></script>
<script type="text/javascript" src="../../../script/aui-tab.js"></script>
<script type="text/javascript" src="../../../script/vue.min.js"></script>
<script type="text/javascript" src="../../../script/common.js"></script>
<script type="text/javascript">
(function (doc, win) {
  	var docEl = doc.documentElement,
  	resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
  	recalc = function () {
    		var clientWidth = docEl.clientWidth;
    		if (!clientWidth) return;
    		docEl.style.setProperty('font-size',(clientWidth / 10) + 'px','important');
  	};
  	if(!doc.addEventListener){
        return
    };
  	win.addEventListener(resizeEvt, recalc, false);
  	doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);
var pf = 1;
var search_history = []; //历史搜索列表数据
apiready = function () {
		//解析元素 tapmode 属性，优化点击事件处理 - 第四步
		api.parseTapmode();
    platformChange($api.getStorage("PlatformType") - 1);
}

// 查找平台切换
function platformChange(type){
    document.querySelector(".sgactive").className = '';
    var list = document.querySelectorAll(".platformBox div");
    list[type].className  = 'sgactive';
    if(type == 0){
        document.querySelectorAll(".platformMsg1")[0].innerText="淘宝"
        document.querySelectorAll(".platformMsg1")[1].innerText="淘宝"
        document.querySelector(".orderCourseImg").src="../../../image/me/orderNum1.png"
    }else if (type == 1) {
        document.querySelectorAll(".platformMsg1")[0].innerText="拼多多"
        document.querySelectorAll(".platformMsg1")[1].innerText="拼多多"
        document.querySelector(".orderCourseImg").src="../../../image/me/orderNum2.png"
    }else if (type == 2) {
        document.querySelectorAll(".platformMsg1")[0].innerText="京东"
        document.querySelectorAll(".platformMsg1")[1].innerText="京东"
        document.querySelector(".orderCourseImg").src="../../../image/me/orderNum3.png"
    }
    pf = type + 1;
}

// 找回订单号
function orderNumFun(){
    var searchOrderNum = document.getElementsByClassName('orderNumInput')[0].value
    if(searchOrderNum.indexOf("-") != -1 ){
        var pddClip = searchOrderNum.replace("-","");
        if(!/^[0-9]*$/.test(pddClip)){
            api.toast({
                msg: '请输入正确格式的订单号',
                duration: 1000,
                location: 'middle'
            });
            return
        }else{
            api.showProgress({
                title: '订单找回中...',
                text: '请稍后...',
                modal: false
            });
            $api.ajax({
                url: "api/order/searchOid",
                method: 'get',
                data:{
                    values:{
                        trade_id:document.getElementsByClassName('orderNumInput')[0].value,
                        pf:pf
                    }
                }
            }, function (ret,err){
                api.hideProgress();
                if(ret){
                    if(ret.code == 0){
                        api.toast({
                            msg: '订单找回',
                            duration: 2000,
                            location: 'middle'
                        });
                        setTimeout(function(){
                            api.sendEvent({
                                name: 'findOrderScusse',
                                extra: {
                                    pf : pf,
                                }
                            });
                            api.closeWin({});
                        }, 1500);
                    }else{
                        api.toast({
                            msg: ret.msg,
                            duration: 2000,
                            location: 'middle'
                        });
                        setTimeout(function(){
                            api.sendEvent({
                                name: 'findOrderScusse',
                                extra: {
                                    pf: pf,
                                }
                            });
                            api.closeWin({});
                        }, 1500);
                    }
                }else {
                    api.toast({
                        msg: '网络错误,请稍后重试',
                        duration: 1000,
                        location: 'middle'
                    });
                }
            })
        }
    }
    if(/^[0-9]*$/.test(searchOrderNum)){
        api.showProgress({
            title: '订单找回中...',
            text: '请稍后...',
            modal: false
        });
        $api.ajax({
            url: "api/order/searchOid",
            method: 'get',
            data:{
                values:{
                    trade_id:document.getElementsByClassName('orderNumInput')[0].value,
                    pf:pf
                }
            }
        }, function (ret,err){
            api.hideProgress();
            if(ret){
                if(ret.code == 0){
                    api.toast({
                        msg: '订单找回',
                        duration: 2000,
                        location: 'middle'
                    });
                    setTimeout(function(){
                        api.sendEvent({
                            name: 'findOrderScusse',
                            extra: {
                                pf : pf,
                            }
                        });
                        api.closeWin({});
                    }, 1500);
                }else{
                    api.toast({
                        msg: ret.msg,
                        duration: 2000,
                        location: 'middle'
                    });
                    setTimeout(function(){
                        api.sendEvent({
                            name: 'findOrderScusse',
                            extra: {
                                pf: pf,
                            }
                        });
                        api.closeWin({});
                    }, 1500);
                }
            }else {
                api.toast({
                    msg: '网络错误,请稍后重试',
                    duration: 1000,
                    location: 'middle'
                });
            }
        })
    }else{
        api.toast({
            msg: '请输入正确格式的订单号',
            duration: 1000,
            location: 'middle'
        });
    }
}

//打开专属客服页面
function openExclusiveFun(){
		api.openTabLayout({
				name: 'exclusive',
				url: '../exclusive.html',
				useWKWebView: true,
				bgColor: '#fff',
		});
}
</script>
</html>
